<div class="accordion" id="employees">
<?php
//grab the accounts
$getAccountsResult = getAccounts($userName, $userPassHash);
//parse the accounts
foreach ($getAccountsResult["results"] as $accountEntry) {
	viewEmpShifts($accountEntry["accName"]);
}
?>
</div>

<?php
function viewEmpShifts($accName){
	$getShiftResults = checkWorkersUpcomingShifts($_SESSION["userName"], $_SESSION["userPassHash"],date("Y/m/d"),$accName);
	$errorMessage = $getShiftResults[0];

	if($errorMessage == ErrorCode::successRead){
	$shifts = $getShiftResults[1];


?>
	
	<div class='accordion-group'>
		<div class='accordion-heading'>
			<a class='accordion-toggle' data-toggle='collapse' data-parent='#employees' href="#<?=$accName?>" ><?=$accName?></a>
		</div>
		<div id="<?=$accName?>" class='accordion-body collapse'>
			<div class='accordion-inner'>
				<table class='table table-condensed table-striped'>
		 			<tr class='row'>
		 				<th>Role</th>
		 				<th>Date</th>
		 				<th>From</th>
		 				<th>To</th>
		 				<th>Status</th>
		 			</tr>
		 		<?php
				foreach ($shifts as $shift) { ?>
				  		<tr class='row'>
							<td><?=$shift["roleName"]?></td>
							<td><?=date("d-M-Y", strtotime($shift["datestamp"]))?></td>
							<td><?=date("g:iA", strtotime($shift["startTime"]))?></td>
							<td><?=date("g:iA", strtotime($shift["endTime"]))?></td>
							<td><?=$shift["shiftStatus"]?></td>
			  			</tr>
				<?php }	?>
				</table>
			</div>
		</div>
	</div>
<?php }
} ?>